package dispatcher.group.gui.floor;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

/**
 * This class creates a default floor panel that is used as the title for at the top of all the
 * floors
 * @author Caleb
 *
 */
public class FloorTitlePanel extends JPanel{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8727497356876933161L;


	/**
	 * The main constructor
	 */
	public FloorTitlePanel() {
		// Sets a fixed size for the panel
		this.setPreferredSize(new Dimension(200, 100));
		this.setMaximumSize(new Dimension(200, 100));
		this.setLayout(new BorderLayout());
		
		createFloorBorder();
	}
	
	/**
	 * This method will create a border around the panel
	 */
	public void createFloorBorder(){
		TitledBorder shaft = BorderFactory.createTitledBorder("");
		shaft.setTitleJustification(TitledBorder.CENTER);
		shaft.setTitleColor(Color.BLACK);
		this.setBorder(shaft);
	}
	
	/**
	 * A custom paint method
	 */
	@Override
	public void paint(Graphics g){
		super.paint(g);
		// Write "Floors" in a different font from the default
		g.setFont(new Font("Book Antiqua", Font.PLAIN, 30));
		g.setColor(Color.BLACK);
		g.drawString("Floors", 50, 50);
	}
}
